package com.jjclub.controller.system;

import com.jjclub.service.system.RoleService;
import com.jjclub.service.system.UserService;
import com.jjclub.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Classname UserController
 * @Description TODO
 * @Date 2019/11/22 15:44
 * @author  by jq
 */
@Api(value = "用户管理",description = "用户管理")
@Controller
@RequestMapping("userAction")
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private RoleService roleService;


    @GetMapping("userListPage")
    public String userListPage(){
        return "service/user/userList";
    }

    @ApiOperation(value = "用户管理",notes = "获取用户列表")
    @GetMapping("userList")
    @ResponseBody
    public ResponseVO userList(Integer page,Integer limit){
       ResponseVO responseVO = userService.userList(page,limit);
       return responseVO;
    }
    @GetMapping("page/userAdd")
    public String userAdd(Model model){
        model.addAttribute("roles", roleService.getRoles());
        return "service/user/add";
    }
}
